package com.exercise.animations

import android.view.LayoutInflater
import android.view.animation.AnimationUtils
import com.exercise.animations.animation.AnimationActivity
import com.exercise.animations.databinding.ActivityMainBinding
import com.exercise.animations.flip_animator.CardFlipActivity
import com.exercise.animations.reveal_animation.RevealAnimationActivity
import com.exercise.animations.spring_animation.SpringAnimationActivity
import com.exercise.animations.viewgroup.ViewGroupActivity
import com.exercise.animations.zoom_animation.ZoomActivity
import com.exercise.struct.base.BaseActivity
import com.exercise.struct.ext.start
import com.exercise.struct.viewmodel.BaseViewModel

class MainActivity : BaseActivity<BaseViewModel, ActivityMainBinding>() {
    override val bindingInflater: (LayoutInflater) -> ActivityMainBinding
        get() = ActivityMainBinding::inflate
    override val modelClass: Class<BaseViewModel>
        get() = BaseViewModel::class.java

    override fun initData() {
    }

    override fun initView() {
        binding.viewGroup.setOnClickListener {
            ViewGroupActivity.start(this)
        }
        binding.animation.setOnClickListener {
            AnimationActivity.start(this)
        }

        val hyperspaceAnimation = AnimationUtils.loadAnimation(this, R.anim.hyperspace_jump)
        binding.imageView.setOnClickListener {
            it.startAnimation(hyperspaceAnimation)
        }

        binding.cardFlip.setOnClickListener {
            CardFlipActivity.start(this)
        }

        binding.revealAnimation.setOnClickListener {
            RevealAnimationActivity.start(this)
        }
        binding.zoomAnimation.setOnClickListener {
            ZoomActivity.start(this)
        }
        binding.springAnimation.setOnClickListener {
            start(SpringAnimationActivity::class.java)
        }
    }
}